package com.douqu.game.core.config.challenge;


import com.douqu.game.core.config.common.GoodsData;
import com.douqu.game.core.util.LoadUtils;

/**
 * @author wangzhenfei
 *         2017-10-19 14:50
 */
public class OfficialRankConfig extends BattleInitConfig {

    public String avatar;
    /**
     * 所属阵营
     */
    public int camp;
    /**
     * 最大容纳人数
     */
    public int maxPerson;
    /** 每日奖励组 */
    public GoodsData[] dailyReward;

    /** 首次奖励组 */
    public GoodsData[] firstReward;

    /** 通过奖励积分 */
    public GoodsData[] passReward;
    /**
     * 特权id
     */
    public int privilegeId;

    @Override
    public boolean check() {
        return super.check();
    }

    @Override
    public boolean setVariable(String key, String value) {
        if("dailyReward".equals(key))
        {
            dailyReward = LoadUtils.loadGoodDataToArray(key, value);
            return LoadUtils.checkGoods(dailyReward, this.getClass(), key, id);
        }
        else if ("firstReward".equals(key))
        {
            firstReward = LoadUtils.loadGoodDataToArray(key, value);
            return LoadUtils.checkGoods(firstReward, this.getClass(), key, id);
        }
        else if ("passReward".equals(key))
        {
            passReward = LoadUtils.loadGoodDataToArray(key, value);
            return LoadUtils.checkGoods(passReward, this.getClass(), key, id);
        }
        else
            return super.setVariable(key, value);
    }

    @Override
    public String toString() {
        return "OfficialRackObject{" +
                "camp=" + camp +
                "} " + super.toString();
    }
}
